 {layout name="layout" /}
<!-- Main content -->
<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header with-border">
                {if condition="isset($data)"}
                <h3 class="box-title">修改内容</h3> {else /}
                <h3 class="box-title">新增内容</h3> {/if}
            </div>
            <!-- /.box-header -->
            <div class="box-body">
                <form class="form-horizontal ingeAjax" action="{if condition=" isset($data) "}{:url('home/News/edit','id='.$data['new_id'])}{else /}{:url('home/News/edit')}{/if}" method="post">
                    <div class="space-2"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章所属栏目:</label>
                        <div class="col-sm-10">
                            <select name="term_id" class="select2 form-group-new  col-xs-12 col-sm-4">
                                {$menulist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章标题： </label>
                        <div class="col-sm-10">
                            <input type="text" name="new_title" value="{$data.new_title|default=''}" class="form-group-new  col-xs-12 col-sm-7" placeholder="文章标题,必填" required/>
                            <input type="text" style="margin-left: 10px;" name="new_titleshort" value="{$data.new_titleshort|default=''}" placeholder="副标题" class="form-group-new  col-xs-12 col-sm-3">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章属性： </label>
                        <div class="col-sm-10" style="padding-top: 5px;">
                            {if condition="isset($data)"}
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="h" {if condition="in_array('h',$new_flag)"}checked{/if}>头条
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="c" {if condition="in_array('c',$new_flag)"}checked{/if}>推荐
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="f" {if condition="in_array('f',$new_flag)"}checked{/if}>幻灯
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="a" {if condition="in_array('a',$new_flag)"}checked{/if}>置顶
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="s" {if condition="in_array('s',$new_flag)"}checked{/if}>滚动
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="p" {if condition="in_array('p',$new_flag)"}checked{/if}>图片
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="j" {if condition="in_array('j',$new_flag)"}checked{/if}>跳转
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="d" {if condition="in_array('d',$new_flag)"}checked{/if}>原创 
                            {else / }
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="h">头条
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="c">推荐
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="f">幻灯
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="a">置顶
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="s">滚动
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="p">图片
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="j">跳转
                            <input type="checkbox" name="new_flag[]" class="flat-blue" value="d">原创 
                            {/if}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 关键词： </label>
                        <div class="col-sm-10">
                            <input type="text" name="new_key" value="{$data.new_key|default=''}" class="form-group-new  col-xs-12 col-sm-7" placeholder="不同关键词之间英文逗号','分隔">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 跳转地址： </label>
                        <div class="col-sm-10">
                            <input type="text" name="new_zaddress" value="{$data.new_zaddress|default=''}" class="form-group-new  col-xs-12 col-sm-7" placeholder="跳转地址,属性选择跳转有效">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 封面图片上传： </label>
                        <div class="col-sm-10">
                            <script type="text/plain" id="upload_ue_img"></script>
                            <input type="hidden" class="form-group-new  col-xs-12 col-sm-4" name="new_img" value="{$data.new_img|default=''}">
                            <img class="upload_ue_img" src="{$data.new_img|default=''}">
                            <a name="upload_ue_img" href="javascript:;" class="btn btn-info" style="margin-left: 10px;">上传图片</a>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 是否审核：</label>
                        <div class="col-sm-10" style="padding-top: 5px;">
                            <input type="checkbox" name="new_status" class="flat-blue" value="d">默认不审核
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 排序（从小到大）：</label>
                        <div class="col-sm-10">
                            <input type="text" name="listorder" value="{$data.listorder|default='50'}" class="form-group-new  col-xs-2 col-sm-1" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 显示时间： </label>
                        <div class="col-sm-10">
                            <div class="input-group date col-xs-12 col-sm-4">
                                <div class="input-group-addon">
                                    <i class="fa fa-calendar"></i>
                                </div>
                                <input type="text" class="form-control pull-right detailtime" name="new_showtime" value="{if condition="isset($data)"}{$data.new_showtime|default=''}{else /}{:date('Y-m-d H:i')}{/if}">
                            </div>
                            <span class="lbl col-xs-12 col-sm-4">&nbsp;&nbsp;<span class="blue">*</span>显示在前台的时间和具体显示时间</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章简介：</label>
                        <div class="col-sm-10">
                            <textarea name="new_scontent" class="form-group-new  col-xs-12 col-sm-7">{$data.new_scontent|default=''}</textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 文章内容：</label>
                        <div class="col-sm-10">
                            <script id="uEditor" type="text/plain" style="height:300px;">
                                {$data.new_content|default=''}
                            </script>
                        </div>
                    </div>
                    <div class="form-actions">
                        <div class="col-md-offset-3 col-md-9">
                            <button class="btn btn-primary" type="submit">
                                <i class="fa fa-check bigger-110"></i> 保存
                            </button> &nbsp; &nbsp; &nbsp; {if condition="isset($data)"}
                            <button class="btn" type="reset" onclick="history.go(-1);"><i class="fa fa-undo"></i> 返回</buttton>{else /}
                                <button class="btn" type="reset"><i class="fa fa-undo bigger-110"></i> 重置</buttton>{/if}
                        </div>
                    </div>
                    <div class="space"></div>
                </form>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>
<!-- /.row -->
</section>
{include file="public/base" /} {include file="public/edit" /}
<script type="text/javascript" charset="utf-8" src="/static/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/plugins/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
var upload_ue_img = UE.getEditor('upload_ue_img', {
    initialFrameWidth: 0,
    initialFrameHeight: 0,
});
upload_ue_img.ready(function() {
    upload_ue_img.setDisabled();
    upload_ue_img.hide();
    upload_ue_img.addListener('beforeInsertImage', function(t, arg) {
        $('input[name="new_img"').val(arg[0].src);
        $('.upload_ue_img').attr('src', arg[0].src);
        $('.upload_ue_img').attr('width', '200px');
        $('.upload_ue_img').attr('height', 'auto');
    });
});
$('a[name="upload_ue_img"]').on('click', function() {
    var myImage = upload_ue_img.getDialog('insertimage');
    myImage.open();
});
var uEditor = UE.getEditor('uEditor');

</script>
{include file="public/footer" /}
</body>

</html>
